package com.gitee.wsl.doc.prosemirror.state

import com.gitee.wsl.doc.prosemirror.model.mark.Mark
import com.gitee.wsl.doc.prosemirror.model.node.Node
import com.gitee.wsl.doc.prosemirror.model.Schema
import com.gitee.wsl.doc.prosemirror.plugin.Plugin
import com.gitee.wsl.doc.prosemirror.state.selection.Selection

// The type of object passed to [`EditorState.create`](#state.EditorState^create).
interface EditorStateConfig {
    // The schema to use (only relevant if no `doc` is specified).
    val schema: Schema?

    // The starting document. Either this or `schema` _must_ be provided.
    val doc: Node?

    // A valid selection in the document.
    var selection: Selection?

    // The initial set of [stored marks](#state.EditorState.storedMarks).
    val storedMarks: List<Mark>?

    // The plugins that should be active in this state.
    val plugins: List<Plugin<*>>

    companion object{
        val empty:EditorStateConfig = EmptyEditorStateConfig()
    }
}

class EmptyEditorStateConfig(
    override val schema: Schema? = null,
    override val doc: Node? = null,
    override var selection: Selection? = null,
    override val storedMarks: List<Mark>? = null,
    override val plugins: List<Plugin<*>> = emptyList()
) : EditorStateConfig

